package com.example.photography.Activity;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.widget.TextView;

import com.example.photography.Model;
import com.example.photography.R;
import com.example.photography.bean.UpdateInfo;
import com.example.photography.common.BaseActivity;

import java.text.SimpleDateFormat;

import butterknife.BindView;
import butterknife.ButterKnife;

public class APK_Dec extends BaseActivity {


    @BindView(R.id.tv_version)
    TextView tvVersion;
    @BindView(R.id.tv_time)
    TextView tvTime;
    @BindView(R.id.tv_dec)
    TextView tvDec;
    private UpdateInfo updateInfo;

    @Override
    protected void initData() {
        updateInfo = Model.getInstance().getUpdateTableDao().getVersion_New();
        if (updateInfo != null) {
            initview();
        }
    }

    private void initview() {
        tvVersion.setText("当前版本为:" + updateInfo.getVersion());
        @SuppressLint("SimpleDateFormat")//date转string
                SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        tvTime.setText("版本更新时间:" + df.format(updateInfo.getTime()));
        tvDec.setText("版本更新细节:" + updateInfo.getDesc_apk());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_apk__dec;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }
}
